package com.binhthuan.catechist.client.form;

import com.binhthuan.catechist.client.ECApplication;
import com.binhthuan.catechist.client.data.GradeDS;
import com.binhthuan.catechist.shared.constant.Parameter;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;

public class GradeForm extends AbstractForm {

    public GradeForm() {
    }

    public GradeForm(GradeDS dataSource) {
        super(dataSource);
        setMargin(10);
        setCellPadding(5);

        HiddenItem id = new HiddenItem(Parameter.ID);
        
        TextItem name = new TextItem(Parameter.NAME);
        name.setTitle(ECApplication.getConstants().name());
        name.setWidth(250);

        SelectItem leader = new SelectItem(Parameter.LEADER);
        leader.setTitle(ECApplication.getConstants().gradeLeader());
        leader.setWidth(250);

        ButtonItem saveButton = createSaveButton();

        setFields(id, name, leader, saveButton);
    }
}
